<?php

include_once 'connection/connection_database.php';

class Boards {

    function FillAll($categories) {
        $sql = "SELECT * FROM cate_board cb, category c WHERE c.category_id=cb.category_id and cb.category_id = {$categories} and cb.board_status=1";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }

    function FillAllLimit($categories) {
        $sql = "SELECT * FROM cate_board cb, category c WHERE c.category_id=cb.category_id and cb.category_id = {$categories} and cb.board_status=1 ORDER BY cb.board_order ASC LIMIT 4";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function FillOne($board) {
        $sql = "SELECT * FROM cate_board WHERE board_id='{$board["id"]}'";
        $result = mysql_query($sql) or die(mysql_error());
        return mysql_fetch_array($result);
    }
    
    function  FillByBoardUrl($board){
        $sql = "SELECT * FROM cate_board WHERE board_url='{$board}'";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function  FillByPageUrl($page){
        $sql = "SELECT * FROM cate_board c, cate_board_page bp WHERE c.board_id = bp.board_id and bp.page_link ='{$page}' and page_status=1";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
}

?>
